/*
 * Profile Model
 * 关于用户的附加信息
 * @Author: chiangbt@geoportal.cn 
 * @Date: 2019-05-13 11:18:00 
 * @Last Modified by: chiangbt@geoportal.cn
 * @Last Modified time: 2019-05-19 13:00:25
 */
const mongoose = require('mongoose');

const profileSchema = mongoose.Schema({
    _id: mongoose.Schema.Types.ObjectId,
    // profile 与 user 有关联
    user: {
        type: mongoose.Schema.Types.ObjectId,
        ref: 'User',
        required: true
    },
    phone: {
        type: String,
        default: '1**********'
    },
    address: {
        type: String,
        default: ''
    }
}, {
    versionKey: false,
    timestamps: {
        createdAt: 'createdAt',
        updatedAt: 'updatedAt'
    }
});

module.exports = mongoose.model('Profile', profileSchema);